	program new
        implicit none
        integer :: lineno=0, iomps=10,iogms=11
        character (len=2048) :: input,line=''

        open(iomps,file='input.mge',status='old')
	open(iogms,file='output.mge')

	do
          read(iomps,'(a)',end=100) input
	  if (input(1:1).eq.'+') then
	    line = trim(line)//trim(adjustl(input(2:)))
	  else
	    if (lineno.gt.0) then
	      write(iogms,'(a,i3.3,a)') '[',lineno,'] '//trim(line)
	      call parse
	    end if
	    line = input
	  endif
	  lineno = lineno + 1
	end do
100	continue

contains
	subroutine parse
	integer ic
        character (len=2048) :: record
	record = line
	call tab2blank(record)       ! Convert tabs to blanks:

	ic = index(record,'::')
	if (ic.gt.0) stop 'Problem: "::" not permitted in input record.'

	ic = index(record,':')
	do while (record<>'')
	  if (ic.eq.0) stop 'No ":" found.  Cannot find label.'
	  label = adjustl(record(1:ic-1))
	  field = adjustl(record(ic+1))
	  jc = index(field,':')
	  if (jc.gt.0) then
	    field = field(1:jc-1)
	    kc = index(field,' ',back=.true.)
	    field = field(1:kc)
	    record = 
	  else



        subroutine tab2blank(line)
        character (len=*) :: line  !! Line to scan for tabs
        character :: tab=char(9)
        integer :: k
        do k=1,len_trim(line)
          if (line(k:k).eq.tab) line(k:k) = ' '
        end do
        return
        end subroutine tab2blank

        end program new
